#ifndef _RAY
#define _RAY

// INCLUDES --------------------------------------------------------------------
#include "base.h"
#include "vertex.h"

// DEFINES ---------------------------------------------------------------------

// TYPEDEFS --------------------------------------------------------------------
typedef struct
{
  union
  {
    vertex4 o, d; // component style (origin, direction)
    vertex4 c[2]; // array style
  };
} ray;

// FUNCTIONS -------------------------------------------------------------------

/* GENERAL:
   d    -> destination
   s    -> source
   size -> array size (0,1 for single elements)

   r    -> arbitrary ray
   k    -> floating point scalar
*/

void rClear(ray *r, ui32 size);            // clear to origin:[0,0,0,1], direction:[0,0,-1,1]
void rCopy (ray *d, ray *s, ui32 size);    // clone ray

// retrieve an arbitrary point p on the line produced by scalar t
void rPoint(vertex4 *d, ray *r, fp k);

#endif // _RAY
